var collectionDiv = document.getElementById("collectionDiv");
var exitButton = document.getElementById("exitButton");
var isLogin;
var parentView;
(function($) {
	setPxPerRem();
	mui.plusReady(function() {
		isLogin = localStorage.getItem("isLogin");
		if(isLogin) {
			var token = localStorage.getItem("token_type") + " " + localStorage.getItem("access_token");
			exitButton.innerHTML = "退出登录";
		} else {
			exitButton.innerHTML = "登录";
		}
	});
})(mui);



$("#about").click(function(){
	var postData = {
		pageflag: "page_me.html"
	}

	var change = {
		pageUrl: 'page_about.html',
		postData: postData,
		aniShow: "fade-in"
	}
	pageChange(change);
});

$("#getNewApp").click(function(){
	var postData = {
		pageflag: "page_me.html"
	}

	var change = {
		pageUrl: 'page_update.html',
		postData: postData,
		aniShow: "fade-in"
	}
	pageChange(change);
});
exitButton.addEventListener('click', function() {
	if(isLogin && this.innerHTML.indexOf("退出") > -1) {
		this.innerHTML = "登录";
		localStorage.removeItem("isLogin");
		localStorage.removeItem("token");
		plus.runtime.quit();
	} 
}, false);

